from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

# 打开浏览器 请求网址
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')

# 定位kw标签 -- 显示等待
kw = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'kw')))
t1 = (By.ID, 'kw')
kw1 = driver.find_element(*t1)

print(kw1.get_attribute('outerHTML'))
print(kw1.get_attribute('name'))
